<?php

/**
 * EncPersona filter form base class.
 *
 * @package    encuestas
 * @subpackage filter
 * @author     qualem
 */
abstract class BaseEncPersonaFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'nombre'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'apellido_paterno' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'apellido_materno' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'telefono'         => new sfWidgetFormFilterInput(),
      'email'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'password'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'grupo_id'         => new sfWidgetFormPropelChoice(array('model' => 'EncGrupo', 'add_empty' => true)),
      'encuesta_id'      => new sfWidgetFormPropelChoice(array('model' => 'EncEncuesta', 'add_empty' => true)),
      'evaluacion_id'    => new sfWidgetFormPropelChoice(array('model' => 'EncEvaluacion', 'add_empty' => true)),
      'evaluacion_grupo' => new sfWidgetFormFilterInput(),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'updated_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'is_actived'       => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
    ));

    $this->setValidators(array(
      'nombre'           => new sfValidatorPass(array('required' => false)),
      'apellido_paterno' => new sfValidatorPass(array('required' => false)),
      'apellido_materno' => new sfValidatorPass(array('required' => false)),
      'telefono'         => new sfValidatorPass(array('required' => false)),
      'email'            => new sfValidatorPass(array('required' => false)),
      'password'         => new sfValidatorPass(array('required' => false)),
      'grupo_id'         => new sfValidatorPropelChoice(array('required' => false, 'model' => 'EncGrupo', 'column' => 'id')),
      'encuesta_id'      => new sfValidatorPropelChoice(array('required' => false, 'model' => 'EncEncuesta', 'column' => 'id')),
      'evaluacion_id'    => new sfValidatorPropelChoice(array('required' => false, 'model' => 'EncEvaluacion', 'column' => 'id')),
      'evaluacion_grupo' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'is_actived'       => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
    ));

    $this->widgetSchema->setNameFormat('enc_persona_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'EncPersona';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'nombre'           => 'Text',
      'apellido_paterno' => 'Text',
      'apellido_materno' => 'Text',
      'telefono'         => 'Text',
      'email'            => 'Text',
      'password'         => 'Text',
      'grupo_id'         => 'ForeignKey',
      'encuesta_id'      => 'ForeignKey',
      'evaluacion_id'    => 'ForeignKey',
      'evaluacion_grupo' => 'Number',
      'created_at'       => 'Date',
      'updated_at'       => 'Date',
      'is_actived'       => 'Boolean',
    );
  }
}
